<script>
// 动态加载组件
import Templates from '@/components/Templates'
import template from '@/mixins/template'

export default {
  name: 'Dynamic',
  mixins: [template],
  provide: {
    templateFlag: true
  },

  computed: {
    dynamicComponent() {
      if (this.tempInfos.template) {
        return Templates[this.tempInfos.template]['Main']
      }
      return ''
    }
  },

  render() {
    const data = {
      props: this.$props,
      attrs: this.$attrs,
      scopedSlots: this.$scopedSlots,
      on: this.$listeners
    }

    return <this.dynamicComponent {...data} />
  }
}
</script>

<style lang="scss" scoped></style>
